package test.db.table.oracle.type;

import test.db.table.Table;
import test.db.util.DBUtil;

/**
 * @author newbie
 * @since 0.1
 */
public enum PwBbsCategoryTable implements Table, ColumnType {
    SID(Column.sid),
    BBS_ID(Column.bbsId),
    TOTAL_CNT(Column.totalCnt),
    CATEGORY_NAME(Column.categoryName),
    BBS_NO(Column.bbsNo),
    REGIST_TIMESTAMP(Column.registTimestamp),
    MODIFY_TIMESTAMP(Column.modifyTimestamp);
    
    private final Column column;
    private static final String TYPE_TOTAL_CNT = "NUMBER(10)";
    private static final String TYPE_CATEGORY_NAME = "VARCHAR2(255)";

    PwBbsCategoryTable(Column column) {
        this.column = column;
    }
    
    private enum Column {
        sid {
            String getType() {
                return TYPE_SID;
            }
        },
        
        bbsId {
            String getType() {
                return TYPE_BBS_ID;
            }
        },
        
        totalCnt {
        	String getType() {
        		return TYPE_TOTAL_CNT;
        	}
        },
        
        categoryName {
            String getType() {
                return TYPE_CATEGORY_NAME;
            }
        },
        
        bbsNo {
            String getType() {
                return TYPE_BBS_NO;
            }
        },
        
        registTimestamp {
            String getType() {
                return TYPE_REGIST_TIMESTAMP;
            }
        },
        
        modifyTimestamp {
            String getType() {
                return TYPE_MODIFY_TIMESTAMP;
            }
        };
        
        abstract String getType();
    }
    
    public String getType() {
        return column.getType();
    }
    
    public void initData() throws Exception {
        DBUtil.addData("INSERT INTO PW_BBS_CATEGORY VALUES ('000000000000000', 'TEST', '1', 'TEST - 1', '20091010101010', '20091010101010')");
        DBUtil.addData("INSERT INTO PW_BBS_CATEGORY VALUES ('000000000000001', 'TEST', '1', 'TEST - 2', '20091010101010', '20091010101010')");
        DBUtil.addData("INSERT INTO PW_BBS_CATEGORY VALUES ('000000000000002', 'TEST', '1', 'TEST - 3', '20091010101010', '20091010101010')");

    }
}